package com.cskaoyan.dbutils;

import com.cskaoyan.connectionpool.DruidUtils;
import com.cskaoyan.dbutils.bean.Account;
import org.apache.commons.dbutils.QueryRunner;

import java.sql.SQLException;

/**
 * 创建日期: 2022/04/23 10:30
 *
 * @author ciggar
 *
 * 使用ResultSetHandler
 *
 *
 */
public class DBUtilsDemo2 {

    public static void main(String[] args) throws SQLException {

        // 创建QueryRunner
        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());

        // 发送SQL语句
        Account account = queryRunner.query("select * from account where id = ?", new MyResultSetHandler());


        System.out.println(account);

    }
}
